package com.yygo.dao.hibernate;

import com.yygo.dao.CertificateDao;
import com.yygo.model.Certificate;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by tiansha on 2015/7/6.
 */
@Repository("certificateDao")
public class CertificateDaoHibernate extends GenericDaoHibernate<Certificate, Long> implements CertificateDao {

    public CertificateDaoHibernate() {
        super(Certificate.class);
    }

    @Override
    public List<Certificate> getCertificatesByType(String type) {
        List certificates = getSession().createCriteria(Certificate.class).add(Restrictions.eq("type", type)).list();
        return certificates;
    }
}
